<?php
include('../../inc/global.inc');
include("../islogin.php");
$url="hot_pro_check2.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;
?>
<?php
//删除信息
if($_GET['del_act']){
$urls=$_SERVER['HTTP_REFERER'];

mysql_query("delete from hot_pro where id='".$_GET['del_id']."'");


echo "<script>location='".$urls."';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</HEAD>
<BODY>
<center>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">已审核的热门产品列表&nbsp;&nbsp;<a href="javascript:history.go(-1)">Back</a></td>
    </tr>
  </table>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <form method="get" action="" name="form1">
      <tr>
        <td height="25" bgcolor="#EEEEF9" style="padding:5px;line-height:25px;"><strong>高级搜索:</strong>搜索内容:
          <input name="search_name" type="text" size="15" maxlength="20">
          账号，产品名称&nbsp;&nbsp;&nbsp;<input name="search_id" type="text" size="15" maxlength="20">编号【id】&nbsp;&nbsp;是否通过审核<input type="checkbox" name="p_sh" value="1" <?php if($_GET[p_sh]==1){echo "checked";}?>><input name="submit" type="submit" value="搜索">
        </td>
      </tr>
    </form>
  </table>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
        <td width="4%" height="30" align="center" bgcolor="#8DA8CF">&nbsp;</td>
      <td width="4%" height="30" align="center" bgcolor="#8DA8CF">编号</td>
      <td width="8%" align="center" bgcolor="#8DA8CF">图片</td>
      <td width="26%" align="center" bgcolor="#8DA8CF">产品名称</td>
      <td width="15%" align="center" bgcolor="#8DA8CF">会员账号</td>
      <td width="10%" align="center" bgcolor="#8DA8CF">城市</td>
      <td width="18%" align="center" bgcolor="#8DA8CF">发布时间</td>
         <td width="4%" align="center" bgcolor="#8DA8CF">是否认证</td>
      <td width="10%" align="center" bgcolor="#8DA8CF">管理</td>
    </tr>
<form action="pro_check.php" method="post">
<?php
if($_GET[search_name]){
$search_sql=" and (hot_pro.p_title like '%$_GET[search_name]%' or member.m_user like '%$_GET[search_name]%')";
}
if($_GET[search_id]){
$search_sql=" and (hot_pro.id='$_GET[search_id]')";
}
if($_GET[p_sh]==1){
$search_sql.=" and hot_pro.p_sh='$_GET[p_sh]'";
}
else{
	$search_sql.=" and hot_pro.p_sh=0";
}
$sql="select hot_pro.id,hot_pro.picture,hot_pro.p_title,hot_pro.catalog_1,hot_pro.catalog_2,hot_pro.catalog_3,hot_pro.member_id,hot_pro.p_addtime,hot_pro.p_cl,member.m_user,member.city,member.m_rz_ok from hot_pro inner join  member on hot_pro.member_id=member.id where hot_pro.p_cl=1 ".$search_sql." order by hot_pro.id desc limit ".($thepage-1)*$maxpage.",$maxpage";
//echo $sql;
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
?>
    <tr bgcolor=<?=$color?>>
        <td><input type="checkbox" value="<?=$row['id']?>" name="id[]"</td>
      <td height="25" align="center"><?=$i?></td>
	  <td height="25" align="center"><?php if($row[picture]){?><img src="http://www.sandib2b.cn/upfile/<?=$row[picture]?>" width="40" height="40" border="0" /><?php }?></td>
	  <td align="left" style="padding-left:5px;"><?=$row[p_title]?></td>
	  <td align="center"><?=$row['m_user']?></td>
	  <td align="center"><?=$row['city']?></td>
      <td align="center"><?php if($row[p_addtime]>=date("Y-m-d")){?><font color="#FF0000"><?=$row[p_addtime]?></font><?php }else{?><?=$row[p_addtime]?><?php }?></td>
      <td align="center" style="color:red">
        <?php if($row[m_rz_ok]){ ?>是<?php } ?>    
      </td>
      <td align="center"><a href="hot_pro_modify.php?xg_id=<?=$row['id']?>">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<?=$url?>?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
	</tr>
	<tr>
	<td colspan="9" height="25" style="background-color:<?=$color ?>">分类： <?=$row[catalog_1] ?> —— <?=$row[catalog_2] ?> —— <?=$row[catalog_3] ?></td>
	</tr>
<?php
$i++;}
//分页参数
$rs2=mysql_query("select count(hot_pro.id) from hot_pro inner join  member on hot_pro.member_id=member.id where hot_pro.p_cl=1   ".$search_sql);
$totalrecord=mysql_result($rs2,0);
$totalpage=ceil($totalrecord/$maxpage);
mysql_free_result($rs2);
?>

</form>
<tr><form method="get" action="<?=$url?>?p_sh=<?=$_GET[p_sh]?>">
   <td height="25" colspan="9" align="center" bgcolor="#FFFFFF">
<?php if($thepage>1){?>
   <a href="<?=$url?>?p_sh=<?=$_GET[p_sh]?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>&p_sh=<?=$_GET[p_sh]?>">上一页</a>&nbsp;
<?php }?>  
<?php if($thepage!=$totalpage&&$totalpage>0){?>
   <a href="<?=$url?>?page=<?=$thepage+1?>&p_sh=<?=$_GET[p_sh]?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>&p_sh=<?=$_GET[p_sh]?>">最后一页</a>&nbsp;
<?php }?>   
   【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条记录】【共<font color="red"><?=$totalpage?></font>页】<input type="text" name="page" size="3" onKeyUp="IsDigit(this);">&nbsp;<input type="submit" value="GO"></td></form>
</tr>
  </table>
</center>
</BODY>
</HTML>

<script src="../../js/jquery.js"></script>
<script language="javascript">
function IsDigit(obj) 
{ 
if(obj.value.replace(/[\d+]/ig,"").length>0) { 
  alert('enter an number'); 
  document.getElementById(obj).value =""; 
} 
}

$(function()
{
    $("#select_all").click(function()
    {

        $("input[name='id[]']").attr("checked","checked");

    });
    $("#select_none").click(function()
    {

        $("input[name='id[]']").removeAttr("checked");

    });
});
</script>
